package cn.bugstack.springframework.util;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author ouyangzhao
 * 类加载工具类
 */
public class ClassUtils {

    private static final Logger LOG = LoggerFactory.getLogger(ClassUtils.class);


    public static ClassLoader getClassLoader() {
        ClassLoader classLoader = null;
        try {
            classLoader = Thread.currentThread().getContextClassLoader();
        } catch (Throwable e) {
            LOG.error("Exception while loading");
        }
        if (classLoader == null) {
            classLoader = ClassUtils.class.getClassLoader();
        }
        return classLoader;
    }

}
